layui.use(['layer', 'form', 'admin', 'ax','upload'], function () {
    var $ = layui.jquery;
    var $ax = layui.ax;
    var form = layui.form;
    var admin = layui.admin;
    var layer = layui.layer;
    var upload = layui.upload;
    /**
     * 检索店名
     */
    var languageAjax = new $ax(Feng.ctxPath + "/btyBxda/getDm");
    var languageResult = languageAjax.start();
    $.each(languageResult, function( index, val ) {
        $("#dm").append("<option value='"+val.dm+"'>"+val.dm+"</option>");
    } );
    form.render('select');

    var ajax = new $ax(Feng.ctxPath + "/btyBxda/info?id=" + $("#id").val());
    var result = ajax.start();
    var flag=result.roleFlag;
    if(flag==1){
        $("#dm").attr("disabled","disabled");
    }
    form.val('noticeForm', result);




    // 表单提交事件
    form.on('submit(btnSubmit)', function (data) {
        $("#dm").removeAttr("disabled","disabled");
        var operation = function () {
            var ajax = new $ax(Feng.ctxPath + "/btyBxda/updateKj", function (data) {
                Feng.success("修改成功！");
                //传给上个页面，刷新table用
                admin.putTempData('formOk', true);
                //关掉对话框
                admin.closeThisDialog();
            }, function (data) {
                Feng.error("修改失败！" + data.responseJSON.message)
            });
            ajax.set(data.field);
            ajax.start();
        };
        Feng.confirm("是否批量修改会计?", operation);
        //添加 return false 可成功跳转页面
        return false;
    });

});